package com.netease.financial.data.repository.datasource;

import com.netease.financial.data.cache.NfsCache;
import com.netease.financial.data.entity.AccessTokenCheckEntity;
import com.netease.financial.data.entity.ActivityPageEntity;
import com.netease.financial.data.entity.AppUpdateEntity;
import com.netease.financial.data.entity.LaunchPageEntity;
import com.netease.financial.data.entity.LoginEntity;
import com.netease.financial.data.entity.LogoutEntity;
import com.netease.financial.data.entity.PageInfoEntity;
import com.netease.financial.data.entity.RegisterEntity;
import com.netease.financial.data.entity.UnreadMessageCountEntity;
import com.netease.financial.domain.interactor.RegisterInput;

import java.util.List;

import rx.Observable;

/**
 * {@link NfsDataStore} implementation based on file system data store.
 */
public class DiskNfsDataStore implements NfsDataStore {

    private final NfsCache nfsCache;

    /**
     * Construct a {@link NfsDataStore} based file system data store.
     *
     * @param nfsCache A {@link NfsCache} to cache data retrieved from the api.
     */
    public DiskNfsDataStore(NfsCache nfsCache) {
        this.nfsCache = nfsCache;
    }

    @Override
    public Observable<AppUpdateEntity> getAppUpdateInfo(final String device, final int versionCode) {
        return this.nfsCache.getAppUpdateEntity(versionCode);
    }

    @Override
    public Observable<UnreadMessageCountEntity> getUnreadMessageCount(String accessToken) {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<LoginEntity> login(String clientId, String clientSecret, String appSecret) {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<LogoutEntity> logout(String accessToken, String appSecret) {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<AccessTokenCheckEntity> checkAccessToken(String accessToken, String appSecret) {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<ActivityPageEntity> getActivityPageInfo() {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<LaunchPageEntity> getLaunchPageInfo(int widthPixels, int heightPixels, String platform) {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<RegisterEntity> register(RegisterInput registerInput) {
        // No need to cache to disk
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

    @Override
    public Observable<PageInfoEntity> getPageInfo(String pageName, List<String> elements, int widthPixels, int heightPixels, String platform) {
        throw new UnsupportedOperationException("Operation is not available!!!");
    }

}
